﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;

namespace Steamrunner
{
    class Timer
    {
        int timeLeft = 0;
        int interval = 0;

        public int TimeLeft
        {
            set { timeLeft = value; }
        }

        public Timer(int timeLeft, int interval)
        {
            this.timeLeft = timeLeft;
            this.interval = interval;
        }

        public bool Update(GameTime gameTime)
        {
            timeLeft -= gameTime.ElapsedGameTime.Milliseconds;
            if (timeLeft <= 0)
            {
                timeLeft = interval;
                return true;
            }
            return false;
        }

        public void Flush()
        {
            timeLeft = interval;
        }
    }
}
